<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>
                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <form class="form-inline" action="" method="POST">
                                <label class="inline">订单获取</label>
								<input type="text" name="po_name" value="{:I(keyword)}" class="form-control">
								 <button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    按采购单号从ERP获取
                                </button>
							
                                <label class="inline">商品搜索</label>
                                <select name="POnameList">
                                        <option value="">请选择批次名</option>
                                    <volist name="POnameList" id="vvv">
                                        <option value="{$vvv.po_name}" <if condition="$vvv.po_name eq I('POnameList')">selected="selected" </if>>{$vvv.po_name}</option>
                                    </volist>
                                    
                                    
                                </select>
                                <!--<input type="text" name="keyword" value="{:I(keyword)}" class="form-control">-->
                          
                                <button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    搜索
                                </button>
                            </form>
                        </div>
                        <div class="space-4"></div>
                        <div class="row">
                            <style>
                                .table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td {
                                    padding:  5px;
                                }
                            </style>
                            <form id="form" method="post" action="{:U('editBath')}">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                        <th>产品名</th>
                                        <th>来源订单</th>
                                        <th class="center">参考/成本</th>
                                        <th class="center">市场价</th>
					<th class="center">网站价</th>
                                        <th>成本价</th>
                                        <th>分类ID</th>
                                        <th>原产国</th>
                                        <th>商品品牌</th>
                                        <th>税号</th>
                                        <th>消费税</th>
                                        <th>关税</th>
                                        <th>增值税</th>
                                        <th>关键词</th>
                                        <th>贸易模式</th>
                                        <th>库存</th>
                                        <th>计价单位</th>
                                        <th>过期时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <volist name="list" id="val">
                                        <tr>
                                            <td class="center">
                                                <input class="uids" type="hidden"  name="ids[]"  value="{$val['id']}">{$val['id']}                                              
                                            </td>
                                            <td>[{$val['sku']}]{$val['name']}</td>
                                            <td class="grouptd">
                                              {$val['partner_name']}
                                            </td>
                                            <td class="center"> {$val['ref_price']}/ {$val['local_price']}</td>
                                            <td class="center" ><input type="text" name="market_price[]"  contenteditable="true" value="{$val['market_price']}" style='width:70px;'/></td>
                                            <td class="center" ><input type="text" name="price[]"  contenteditable="true" value="{$val['price']}" style='width:70px;'/></td>
                                            <td class="center" ><input type="text" name="cost_price[]"  contenteditable="true" value="{$val['cost_price']}" style='width:70px;'/></td>
                                            <td class="center" ><input type="text" name="goods_type_id[]"  contenteditable="true" value="{$val['goods_type_id']}" style='width:50px;'/></td>

                                            <td class="center" >
                                                <!--<input type="text" name="trade_type[]"  contenteditable="true" value="{$val['trade_type']}"/>-->
                                                <select name="made_in[]" >
                                                    <option value="0" >请选择原产国</option>
                                                    <volist name="madeinlist" id="madein" >
                                                        <option value="{$key}" <if condition="$key eq $val['made_in']"> selected="selected" </if>>{$madein.Chinese_name}</option>
                                                    </volist>
                                                    
                                                </select>
                                            </td>
                                            <td class="center" >
                                                <!--<input type="text" name="trade_type[]"  contenteditable="true" value="{$val['trade_type']}"/>-->
                                                <select name="goods_brand_id[]" class="goods_brand_id_{$val['id']}" style="width:130px;">
                                                    <option value="0" >请选择商品品牌</option>
                                                    <volist name="goods_brand_idlist" id="madein" >
                                                        <option value="{$madein.id}" <if condition="$madein.id eq $val['goods_brand_id']"> selected="selected" </if>>{$madein.name}</option>
                                                    </volist>
                                                    
                                                </select>
                                            </td>
                                            
                                            <td class="center" ><input type="text" name="tax_no[]"  contenteditable="true" value="{$val['tax_no']}" style='width:70px;'/></td>
                                            <td class="center" ><input type="text" name="tax_xf[]"  contenteditable="true" value="{$val['tax_xf']}" style='width:80px;'/></td>
                                            <td class="center" ><input type="text" name="tax_gw[]"  contenteditable="true" value="{$val['tax_gw']}" style='width:80px;'/></td>
                                            <td class="center" ><input type="text" name="tax_add[]"  contenteditable="true" value="{$val['tax_add']}" style='width:80px;'/></td>
                                            <td class="center" ><input type="text" name="info_keywords[]"  contenteditable="true" value="{$val['info_keywords']}" style='width:100px;'/></td>
                                            <td class="center" >
                                                <select name="trade_type[]" >
                                                    <option value="0" >请选择贸易模式</option>
                                                    <volist name="tradelist" id="trade" >
                                                        <option value="{$key}" <if condition="$key eq $val['trade_type']"> selected="selected" </if>>{$trade}</option>
                                                    </volist>
                                                    
                                                </select>
                                            </td>
                                            <td class="center" ><input type="text" name="stock[]"  contenteditable="true" value="{$val['stock']}" style='width:50px;'/></td>
                                            <td class="center" ><input type="text" name="pom[]"  contenteditable="true" value="{$val['pom']}" style='width:50px;'/></td>
                                            <td class="center" ><input type="text" name="exp_time[]"  contenteditable="true" value="{$val['exp_time']}" style='width:90px;'/></td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                            </form>
                            <div class="cf">
                                 <input id="submit2" class="btn btn-info" type="button" value="保存修改">
                            </div>
                            {$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $(".group").click(function () {
            $(this).addClass('hide');
            $(this).parent().find(".groupselect").removeClass('hide');
        })
        $(".groupselect").on("change", function () {
            var ob = $(this);
            var gid = ob.val();
            var uid = ob.parent().find('.group').attr('val');
            $.get("{:U('update')}&ajax=yes&uid=" + uid + "&gid=" + gid, function (data) {
                var text = ob.find("option:selected").text();
                ob.parent().find(".group").removeClass('hide').html(text);
                ob.addClass('hide');
            });
        })

        $(".check-all").click(function () {
            $(".uids").prop("checked", this.checked);
        });
        $(".uids").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("#submit").click(function () {
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除所选用户？",
                callback: function (result) {
                    if (result) {
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
		   $("#submit2").click(function () {
                bootbox.confirm({
                title: "系统提示",
                message: "确认修改价格信息。",
                callback: function (result) {
                    if (result) {
					    $("#form").action="{:U('editBath')}";
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要该用户?",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
    })
</script>
</body>
</html>
